<template>
  <div class="app-container">
    <el-dialog :title="'填写单号'+'（'+form.orderNo+'）'" :visible.sync="dialogVisible" width="30%" append-to-body>
      <el-form ref="form" :model="form">
        <el-form-item label="快递单号" prop="remark" required>
          <el-input type="number" v-model="form.remark" placeholder="请输入"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible=false">取 消</el-button>
        <el-button type="primary" @click="dialogOk">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {approveOrderOk} from "../../../../api/imsMng";

export default {
  data() {
    return {
      loading: false,
      dialogVisible: false,
      form: {}
    }
  },
  methods: {
    show(form) {
      this.dialogVisible = true
      this.form = {}
      this.resetForm('form')
      this.form.id = form.id
      this.form.orderNo = form.orderNo
    },
    dialogOk() {
      this.$refs.form.validate(e => {
        if (e) {
            approveOrderOk(this.form).then(res => {
              this.$emit('ok')
              this.dialogVisible = false
              this.$message.success('填写成功')
            })
        }
      })
    },
  }
}
</script>
